{% extends "events/base.html" %}
{% load i18n %

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/dashboard.css" />{% endblock %}

{% block breadcrumbs %}
	{% if not is_popup %}
		<div class="breadcrumbs">
		     <a href="../../">Home</a> &rsaquo;
		     <a href="../">Event Manager</a> &rsaquo;
		     Add Event
		</div>
	{% endif %}
{% endblock %}

{% block content %}
<form action="" method="POST">
	{% csrf_token %}
	<input type="hidden" name="FORM_COMPLETE" id="FORM_COMPLETE" value="FORM_COMPLETE">
	<input type="hidden" name="event_type" id="event_type" value="{{event_type}}">
	<fieldset class="module aligned {{ fieldset.classes }}">
	        {% for field in form %}
	        <div class="form-row{% if field.errors %} errors{% endif %} {{ field.field.name }}">
	            {{ field.errors }}
	               {% if field.is_checkbox %}
	                   {{ field.field }}{{ field.label_tag }}
	               {% else %}
	                   {{ field.label_tag }}
	                   {% if field.is_readonly %}
	                       <p>{{ field.contents }}</p>
	                   {% else %}
	                       {{ field }}
	                   {% endif %}
	               {% endif %}
	               {% if field.help_text %}
	                   <p class="help">{{ field.help_text|safe }}</p>
	               {% endif %}
	        </div>
	    {% endfor %}
	</fieldset>
 	<div class="submit-row">
 		<p class="deletelink-box"><a href="/events/{{event.id}}/delete" class="deletelink">Delete</a></p>
		<input type="submit" value="Add" class="default" name="_save" {{ onclick_attrib }}/>
		<label>&nbsp;</label><input type="button" value="Cancel" ONCLICK="window.location.href='{% url ocms.eventmanager.views.index %}'"/>
	</div>
</form>
<script>
// Help the user by setting thier user account for them
var planning_team = document.getElementById("id_planning_team");
var A=planning_team.options;
var L=A.length;
while(L){
    if (A[--L].value=={{user.id}}){
    	planning_team.selectedIndex=L;
        L= 0;
    }
}
</script>
{% endblock %}
